package com.home.databinding3

import android.graphics.Color
import android.text.TextUtils
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.squareup.picasso.Picasso

class RecyclerViewImageBindingAdapter {

    companion object{
        @BindingAdapter("itemImage")
        fun setImage(imageView: ImageView,imageUrl:String){
            if(!TextUtils.isEmpty(imageUrl)){
                Picasso.get().load(imageUrl).into(imageView);
            }else{
                imageView.setBackgroundColor(Color.DKGRAY)
            }
        }
    }
}